<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin_login_log', function (Blueprint $table) {
            $table->id()->startingValue(10);
            $table->integer('user_id')->default(0)->unsigned()->comment('用户ID');
            $table->string('account', 255)->default('')->comment('用户name');
            $table->integer('code')->default(0)->comment('登录状态码');
            $table->string('msg', 255)->default('')->comment('登录描述');
            $table->string('ip', 255)->default('')->comment('访问Ip');
            $table->string('region', 255)->default('')->comment('地区');
            $table->string('browser', 100)->default('')->comment('browser');
            $table->integer('created_at')->default(0)->comment('创建时间');
        });
        DB::statement("ALTER TABLE `admin_login_log` comment '【后台】登录日志'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_login_log');
    }
};
